//
// Created by mac on 2/22/22.
//

#include <vector>
using namespace std;
int cutWood1(int k, vector<int> &nums){
    int maxValue = INT_MIN;
    for (int i = 0; i < nums.size(); ++i) {
        maxValue = max(nums[i], maxValue);
    }

    int maxM = 0;
    for (int m = 1; m <=maxValue ; ++m) {
        int cnt = 0;
        for (int i = 0; i < nums.size(); ++i) {
            cnt+=nums[i]/m;
        }

        if(cnt>=k){maxM = max(maxM, m);}
    }
    return maxM;
}